import java.awt.*;
import java.io.Serializable;

public class Tile implements Serializable {
	private static final long serialVersionUID = 1L;
	transient Image floor, ceiling;
	String floor_name, ceiling_name;
	boolean stepOn = true;	// Kachel kann betreten werden

	public void loadFloor(String name, Canvas parent) {
		floor_name = name;
		floor = parent.getToolkit().getImage(name + ".png");
	}
	
	public void loadCeiling(String name, Canvas parent) {
		ceiling_name = name;
		ceiling = parent.getToolkit().getImage(name + ".png");
	}
	
	public void reloadImages(Canvas parent) {
		if (floor_name != null)
			floor = parent.getToolkit().getImage(floor_name + ".png");
		if (ceiling_name != null)
			ceiling = parent.getToolkit().getImage(ceiling_name + ".png");	
	}
	
	public void paint(Graphics g, int x, int y, Canvas parent) {
		if (floor == null)
			System.out.println("Baeh");
		g.drawImage(floor, x * 32, y * 32, 32, 32, parent);
	}
	
	public void paintCeiling(Graphics g, int x, int y, Canvas parent) {
		if (ceiling != null)
			g.drawImage(ceiling, x * 32, y * 32, 32, 32, parent);
	}
}
